package com.gitee.xmhzzz.component.shutdown.graceful.controller;

import com.gitee.xmhzzz.component.shutdown.graceful.service.IShutdownService;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @ClassName ShutdownController
 * @Description
 * @Author wzq
 * @Date 2023/11/6 9:49
 * @Version 1.0
 */

@RestController
@RequestMapping("/graceful")
public class ShutdownController {

    @Resource
    private IShutdownService shutdownServiceImpl;

    @GetMapping("/shutdown")
    public HttpStatus shutdown() {
        shutdownServiceImpl.shutdown();
        return HttpStatus.OK;
    }

    @GetMapping("/startup")
    public HttpStatus startup() {
        shutdownServiceImpl.startup();
        return HttpStatus.OK;
    }
}

